<div class="row">
<script src="/js/clipboard.min.js"></script>
<form action="/weibos/short_url" onsubmit="$('#shortUrlResult').val('生成中...');return ajaxSubmitForm(this,function(request){ $('#urlQrImg').attr('src','/tools/qrcode?uri='+encodeURIComponent(request.uri));if(request.ret==0){$('#shortUrlResult').val(request.uri);}else{$('#shortUrlResult').val(request.msg);}});" id="ShortUrlForm" role="form" method="post" accept-charset="utf-8">		
		<div class="col-md-12  col-xs-12">	
			<div class="form-group">
				<label class="control-label">输入网址: </label>
				<textarea name="uri" class="form-control" placeholder="请输入合法有效的网址" rows="3" required="required" maxlength="300" cols="30"></textarea>
				<p>网址需以http://或https://开头</p>
			</div>
			<div class="form-group">
				<input class="btn btn-primary btn-sm" style="width:180px" type="submit" value="生成短链">

				<input type="text" readonly="readonly" style="line-height:32px;color:green;display:inline-block;font-size:18px;border: 1px dotted #ccc;padding: 0 15px;width: 200px;" id="shortUrlResult">
				<span id="shortUrlCopyBtn" onclick="messaged = false;" class="btn btn-default btn-sm" data-clipboard-target="#shortUrlResult">复制使用</span>

				<hr>
				<p><small>提示：在粘贴或输入网址后，点击生成短链，然后复制使用。同时可在下方生成网址二维码。</small></p>	
				<p class="text-center"><img id="urlQrImg" src="/img/grey.gif"><br><small>网址二维码</small></p>
			</div>
		</div>
</form>
<script>
$('#shortUrlCopyBtn').unbind();
var messaged = false;
var clipboard = new Clipboard('#shortUrlCopyBtn');
clipboard.on('success', function(e) {
	if( !messaged ){
		showSuccessMessage("已成功复制");
	    messaged = true;
	    e.clearSelection();
	}
    
    return false;
});
</script>
</div>

